package cn.fl.system.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.system.dto.SysPgCmpFldRDTO;
import cn.fl.system.vo.SysPgCmpFldRVO;

 /**
 * @Description: 系统页面组件-字段关系表 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class SysPgCmpFldRVOTransform {


	/**
	 * 
	 * DTO 转  VO
	 * @param po SysPgCmpFldRDTO
	 * @return SysPgCmpFldRVO
	 */
	public static SysPgCmpFldRVO toVO(SysPgCmpFldRDTO dto) {
		SysPgCmpFldRVO  vo = null;
		if (dto != null) { 
			vo = new SysPgCmpFldRVO();
			vo.setId(dto.getId());
			vo.setCmpCd(dto.getCmpCd());//组件代码
			vo.setSysCd(dto.getSysCd());//系统代码（SYS0001）
			vo.setFldCd(dto.getFldCd());//FLD_CD

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto SysPgCmpFldRVO
	 * @return SysPgCmpFldRDTO
	 */
	public static SysPgCmpFldRDTO toDTO(SysPgCmpFldRVO vo) {
		SysPgCmpFldRDTO dto = null;
		if (vo != null) {
			dto = new SysPgCmpFldRDTO();
			dto.setId(vo.getId());
			dto.setCmpCd(vo.getCmpCd());//组件代码
			dto.setSysCd(vo.getSysCd());//系统代码（SYS0001）
			dto.setFldCd(vo.getFldCd());//FLD_CD

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<SysPgCmpFldRDTO>
	 * @return List<SysPgCmpFldRVO>
	 */
	public static List<SysPgCmpFldRVO> toVOList(List<SysPgCmpFldRDTO> list) {
		List<SysPgCmpFldRVO>  voList = new ArrayList<SysPgCmpFldRVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (SysPgCmpFldRDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<SysPgCmpFldRVO>
	 * @return List<SysPgCmpFldRDTO>
	 */
	public static List<SysPgCmpFldRDTO> toDTOList(List<SysPgCmpFldRVO> list) {
		List<SysPgCmpFldRDTO>  dtoList = new ArrayList<SysPgCmpFldRDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (SysPgCmpFldRVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
